#ifndef __DEFAULT_SCENE_GRAPH_H__
#define __DEFAULT_SCENE_GRAPH_H__

#pragma once

#include "SceneGrpah.h"

namespace Nezha
{

		typedef DoubleLayersHashMap<SceneNode*, _string, DefStrDoubleHashFunctor> SceneNodeNameMap;
		typedef DoubleLayersHashMap<SceneObject*, _string, DefStrDoubleHashFunctor> SceneObjNameMap;
		typedef PArray<SceneNode*> SceneNodeArray;
		typedef PArray<SceneObject*> SceneObjectArray;
		typedef PMap<int, SceneObjectFactory*> SceneObjFacIntMap;

		/** default scene graph implement. 
		TODO
			typical octree without occlusion culling queries intergrated?
		*/
		class DefaultSceneGraph : public SceneGraph
		{
		public:
			virtual SceneNode* createSceneNode(const _string& name, SceneNode* parent);

			virtual SceneNode* findSceneNode(const _string& name);

			virtual void destroySceneNode(SceneNode* sn);

			virtual SceneObject* create(const _string& name, SceneObjectCreation* params, SceneNode* bindNode = NULL);

			virtual SceneObject* findObject(const _string& name);

			virtual void destroySceneObject(SceneObject* so);

			virtual SceneObjectFactory* getFactoryByTypeInt(int sot);

			virtual void setSceneObjectFactory(SceneObjectFactory* fac);

			virtual void update(float dt);

		protected:
			virtual SceneObjectCreation* loadScript(const _string& scriptName);

			virtual void _insertObject(SceneObject* so);

			//SceneNodeArray mSceneNodeGarbages;
			//SceneObjectArray mSceneObjectGarbages;
			SceneNodeNameMap mSceneNodes;
			SceneObjNameMap mSceneObjects;

			SceneObjFacIntMap mSceneFacIntMap;
		};

}//end namespace Nezha

#endif //end __DEFAULT_SCENE_GRAPH_H__